import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.HashMap;


public class Test {

	public HashMap<String,Integer> argFctPredefinie = new HashMap<String,Integer>();
	
	public HashMap<String,Method> methodFctPredefinie = new HashMap<String,Method>();
	
	
	public Test() {
		argFctPredefinie.put("egalite", 2);
		argFctPredefinie.put("inegalite", 2);
		argFctPredefinie.put("pluspetit", 2);
		argFctPredefinie.put("plusgrand", 2);
		
		
		Class c = Test.class;
		Method[] tab = c.getMethods();
		
		Method  m;
		for (int i=0;i<tab.length;i++) {
			m = tab[i];
			if(m.getName().equals("egalite"))
				methodFctPredefinie.put("egalite", m);
			
			if(m.getName().equals("inegalite"))
				methodFctPredefinie.put("inegalite", m);
			
			if(m.getName().equals("pluspetit"))
				methodFctPredefinie.put("pluspetit", m);
			
			if(m.getName().equals("plusgrand"))
				methodFctPredefinie.put("plusgrand", m);
		}    
	}
	
	
	
	
public static Object egalite(ArrayList<Object> v,  HashMap<String, Object> penv){
		
		if(v.get(0) instanceof Integer) {
			if(v.get(1) instanceof Integer)
				return v.get(0).equals(v.get(1));
			else 
				if(v.get(1) instanceof Double)
					return (int)(Integer)v.get(0) == (Double)v.get(1);
		}
		else
			if(v.get(0) instanceof Double) {
				if(v.get(1) instanceof Double)
					return v.get(0).equals(v.get(1));
			else 
				if(v.get(1) instanceof Integer)
					return (Double)v.get(0) == (int)(Integer)v.get(1);
			}
		return null;
	}
	


	public static Object inegalite(ArrayList<Object> v,  HashMap<String, Object> penv){
		if(v.get(0) instanceof Integer) {
			if(v.get(1) instanceof Integer)
				return !v.get(0).equals(v.get(1));
			else 
				if(v.get(1) instanceof Double)
					return (int)(Integer)v.get(0) != (Double)v.get(1);
		}
		else
			if(v.get(0) instanceof Double) {
				if(v.get(1) instanceof Double)
					return !v.get(0).equals(v.get(1));
			else 
				if(v.get(1) instanceof Integer)
					return (Double)v.get(0) != (int)(Integer)v.get(1);
			}
		return null;
	}


	public static Object pluspetit(ArrayList<Object> v,  HashMap<String, Object> penv){
		
		if(v.get(0) instanceof Integer) {
			if(v.get(1) instanceof Integer)
				return (Integer)v.get(0) < (Integer)v.get(1);
			else 
				if(v.get(1) instanceof Double)
					return (int)(Integer)v.get(0) < (Double)v.get(1);
		}
		else
			if(v.get(0) instanceof Double) {
				if(v.get(1) instanceof Double)
					return (Integer)v.get(0) < (Integer)v.get(1);
			else 
				if(v.get(1) instanceof Integer)
					return (Double)v.get(0) < (int)(Integer)v.get(1);
			}
		return null;
	}


	public static Object plusgrand(ArrayList<Object> v,  HashMap<String, Object> penv){

		if(v.get(0) instanceof Integer) {
			if(v.get(1) instanceof Integer)
				return (Integer)v.get(0) > (Integer)v.get(1);
			else 
				if(v.get(1) instanceof Double)
					return (int)(Integer)v.get(0) > (Double)v.get(1);
		}
		else
			if(v.get(0) instanceof Double) {
				if(v.get(1) instanceof Double)
					return (Integer)v.get(0) > (Integer)v.get(1);
			else 
				if(v.get(1) instanceof Integer)
					return (Double)v.get(0) > (int)(Integer)v.get(1);
			}
		return null;
	}
}
